package edu.gdkm.demo4;

public class Student {
    private String studentId;
    private String name;
    private double cScore;
    private double englishScore;
    private double computerScore;
    public void setcScore(double cScore){
        if(cScore<0){
            this.cScore = 0;
        }else if(cScore>100){
            this.cScore = 100;
        }else{
            this.cScore=cScore;
        }
    }
    public double getcScore(){
        return this.cScore;
    }

    public String getStudentId() {
        return studentId;
    }

    public void setStudentId(String studentId) {
        this.studentId = studentId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getEnglishScore() {
        return englishScore;
    }

    public void setEnglishScore(double englishScore) {
        if(englishScore<0){
            this.englishScore = 0;
        }else if(englishScore>100){
            this.englishScore = 100;
        }else{
            this.englishScore=englishScore;
        }

    }

    public double getComputerScore() {
        return computerScore;
    }

    public void setComputerScore(double computerScore) {
        if(computerScore<0){
            this.computerScore = 0;
        }else if(computerScore>100){
            this.computerScore = 100;
        }else{
            this.computerScore=computerScore;
        }

    }

    public Student() {
    }

    public Student(String studentId, String name) {
        this.studentId = studentId;
        this.name = name;
    }

    public Student(String studentId, String name, double cScore, double englishScore, double computerScore) {
        this.studentId = studentId;
        this.name = name;
        this.cScore = cScore;
        this.englishScore = englishScore;
        this.computerScore = computerScore;
    }

    @Override
    public String toString() {
        return "Student{" +
                "studentId='" + studentId + '\'' +
                ", name='" + name + '\'' +
                ", cScore=" + cScore +
                ", englishScore=" + englishScore +
                ", computerScore=" + computerScore +
                '}';
    }

    public void print(){
        System.out.println("学号："+studentId+",姓名："+name);
    }
    public double average(){
        return (cScore+englishScore+computerScore)/3;
    }
}
